package neo.app.action;

import neo.core.common.PagingList;

public class RoleAction extends BaseAction {
	private PagingList roleList;
	private PagingList users;
	
	//角色列表
	public String list(){
		roleList = getServMgr().getRoleService().getAllRoles();
		return "list";
	}
	
	//添加角色 准备
	public String addPre(){
		return "addPre";
	}
	
	//添加角色
	public String add(){
		if(getServMgr().getRoleService().addRole(getParameters())){
			addMessage("添加角色成功");
			addRedirURL("返回", "role!list.action");
		}else{
			addMessage("操作失败");
			addRedirURL("返回", "@back");
		}
		return EXECUTE_RESULT;
	}
	
	//查看角色下的用户
	public String findUsers(){
		users = getServMgr().getRoleService().getUsersByRoleId(getParameters());
		return "findUsers";
	}
	
	//---------
	public PagingList getRoleList() {
		return roleList;
	}

	public void setRoleList(PagingList roleList) {
		this.roleList = roleList;
	}

	public PagingList getUsers() {
		return users;
	}

	public void setUsers(PagingList users) {
		this.users = users;
	}
}
